package com.zjsx.lib.utils;

import java.util.ArrayList;
import java.util.List;

import com.google.gson.Gson;

/**
 * Created by 张弟 on 2014/7/18.
 */
public class DataUtil {
    public static Gson gson = new Gson();

    public static <T> T dataToObj(byte[] data, Class<T> tClass) {
	return dataToObj(new String(data), tClass);
    }

    public static <T> T dataToObj(String data, Class<T> tClass) {
	return gson.fromJson(data, tClass);
    }

    public static List array2List(Object[] objs) {
	ArrayList list = new ArrayList();
	for (Object obj : objs) {
	    list.add(obj);
	}
	return list;
    }
}
